<?php
/*
 * Copyright (c) 2010, webvariants GbR, http://www.webvariants.de
 *
 * Diese Datei steht unter der MIT-Lizenz. Der Lizenztext befindet sich in der
 * beiliegenden LICENSE Datei und unter:
 *
 * http://www.opensource.org/licenses/mit-license.php
 * http://de.wikipedia.org/wiki/MIT-Lizenz
 */

if ($REX['SETUP'] || defined('_WV24_PATH')) return;
define('_WV24_PATH', $REX['INCLUDE_PATH'].'/addons/realurl2/');

// Addon-Konfiguration

//$REX['ADDON']['rxid']['realurl2']        = 'xxx';
//$REX['ADDON']['page']['realurl2']        = 'realurl2';
//$REX['ADDON']['name']['realurl2']        = 'realURL 2';
$REX['ADDON']['perm']['realurl2']        = 'realurl2[]';
$REX['ADDON']['version']['realurl2']     = file_get_contents(_WV24_PATH.'version');
$REX['ADDON']['author']['realurl2']      = 'Christoph Mewes';
$REX['ADDON']['supportpage']['realurl2'] = 'www.webvariants.de';
$REX['ADDON']['requires']['realurl2']    = array('developer_utils', 'global_settings');

// And here we go!

require_once _WV24_PATH.'functions.core.php';
rex_register_extension('__AUTOLOAD', '_wv24_autoload');

if ($REX['REDAXO']) {
	// Artikel-EPs
	
	rex_register_extension('ART_ADDED',             array('_WV24_RealURL2', 'artAdded'));
	rex_register_extension('ART_UPDATED',           array('_WV24_RealURL2', 'artUpdated'));
	rex_register_extension('ART_DELETED',           array('_WV24_RealURL2', 'artDeleted'));
	rex_register_extension('ART_META_FORM_SECTION', array('_WV24_RealURL2', 'artMetaFormSection'));
	rex_register_extension('ART_META_UPDATED',      array('_WV24_RealURL2', 'artMetaUpdated'));
	
	// Kategorie-EPs
	
	rex_register_extension('CAT_ADDED',     array('_WV24_RealURL2', 'catAdded'));
	rex_register_extension('CAT_UPDATED',   array('_WV24_RealURL2', 'catUpdated'));
	rex_register_extension('CAT_DELETED',   array('_WV24_RealURL2', 'catDeleted'));
	rex_register_extension('CAT_FORM_EDIT', array('_WV24_RealURL2', 'catFormEdit'));
	
	// Sprach-EPs
	
	rex_register_extension('CLANG_ADDED',   array('_WV24_RealURL2', 'clangAdded'));
	rex_register_extension('CLANG_UPDATED', array('_WV24_RealURL2', 'clangUpdated'));
	rex_register_extension('CLANG_DELETED', array('_WV24_RealURL2', 'clangDeleted'));
	
	// Auf Änderungen an den Sprach-Fragmenten reagieren
	
	rex_register_extension('WV8_SETTINGS_UPDATED', array('_WV24_RealURL2', 'settingsUpdated'));
}
else {
	rex_register_extension('ADDONS_INCLUDED', array('_WV24_RealURL2', 'dispatchRequest'));
	rex_register_extension('OUTPUT_FILTER',   array('_WV24_RealURL2', 'outputFilter'));
}

rex_register_extension('URL_REWRITE',   array('_WV24_RealURL2', 'urlRewrite'));
rex_register_extension('ALL_GENERATED', array('_WV24_RealURL2', 'cacheCleared'));
